package iosr11.example;

import iosr11.Service.AttendenceService;
import iosr11.Service.EventService;
import iosr11.Service.ServiceCreator;
import iosr11.Service.ServiceLocatorImpl;
import iosr11.Service.StudentService;
import iosr11.data.Attendence;
import iosr11.data.Event;
import iosr11.data.Student;

public class AttendenceServiceMain {
	public static void main(String args[]){
		ServiceCreator.createService();
		AttendenceService attServ = (AttendenceService) ServiceLocatorImpl.getInstance().getService(Attendence.class);
		StudentService studS = (StudentService) ServiceLocatorImpl.getInstance().getService(Student.class);
		EventService eventS = (EventService) ServiceLocatorImpl.getInstance().getService(Event.class);
		/*
		Student stud = studS.getStudent("j.bajer@gmail.com");
		System.out.println(stud);
		List<Event> events = eventS.getStudentEvents(stud);
		System.out.println(events.size());
		Event e = events.get(0);
		*/
		Event ev = eventS.getCurrentEvent();
		Student st = studS.getStudent("j.fab@gmail.com");
		Attendence at = new Attendence();
		at.setEvent(ev);
		at.setStudent(st);
		at.setPressence(1);
		System.out.println(at);
		
		//System.out.println(attServ.createAttendence(st, ev, 1));
		/*
		List<Attendence> attE = attServ.getAttendencesForEvent(e);
		System.out.println(attE.get(0).getStudent());
		
		/*
		Attendence att = new Attendence();
		att.setEvent(e);
		att.setStudent(stud);
		att.setPressence(1);
		System.out.println(att);*/
		//System.out.println(attServ.createAttendence(stud, e, 1));
		//System.out.println(attServ.addAttendence(att));
		 
		 // */
		
		//System.out.println(attServ.createAttendence(stud, e, 1));
		//System.out.println(attServ.getAll());
	}
	
}
